/**
 * Copyright (C)  2011  chen wei hua.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 2.0
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU Free Documentation License".
 */
package com.javaeye.common.service;

import java.util.List;

public class CheckRequestService {
	
	/**
	 * 用来判断是否可以删除的列表，可能会有多个检查点
	 */
	private List<CheckCanRemove> deleteCheckList;
	

	public void setDeleteCheckList(List<CheckCanRemove> deleteCheckList) {
		this.deleteCheckList = deleteCheckList;
	}
	
	/**
	 * 检查
	 */
	protected boolean checkCanDelete(Object id) {
		for (CheckCanRemove checker : deleteCheckList) {
			boolean canRemove = checker.canRemove(this, id);
			if (!canRemove) {
				return false;
			}
		}
		return true;
	}

}
